<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="s" uri="http://www.springframework.org/tags/form" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html>
<head>
        <title>批量导入订单数据</title>
        <jsp:include page="easyuiIncludeJS.jsp"/>
        <script>
            function check(){
                var fileDir = $('#file').val();
                //获取文件扩展名
                var suffix = fileDir.substr(fileDir.lastIndexOf("."));
                if ("" == fileDir) {
                    alert("选择需要导入的Excel文件！");
                    return false;
                }
                if (".xls" != suffix) {
                    alert("选择后缀为.xls的Excel格式的文件导入！");
                    $('#file').val("");
                    return false;
                }
            }
            function fanhui() {
                location.href="${pageContext.request.contextPath}/admin/materialInput/list"
            }

        </script>
</head>
<body>
        <form name="form1" action="${pageContext.request.contextPath}/admin/materialInput/saveExcel" method="post" enctype="multipart/form-data" onsubmit="return check();">
            <table width="100%" class="table table-celled">
                <tr height="40">
                    <td><font color="red"><b>只支持扩展名为.xls的Excel文件，只有检查验证合格才能导入数据，导入可能要一些时间，请耐心等待</b></font></td>
                </tr>
                <tr height="40">
                    <td>请选择文件:<input  type="file" name="file" id="file"  style="width:300px" label='文件'/>&nbsp;&nbsp;&nbsp;&nbsp;<a href="${pageContext.request.contextPath}/Excel/materialInput.xls"><b>下载导入模板</b></a></td>
                </tr>
                <tr height="40">
                    <td><input type="submit" class="easyui-linkbutton " value="提交">
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="button" class="easyui-linkbutton " onclick="fanhui();"    value="返回"></td>
                </tr>
            </table>
        </form>
        <br/>
        <font size="3" color="red"><b>
            注意事项：<br/>
            <hr color="red"/>
            1.请先下载导入模板，按导入模板的格式填写数据；<br/>
            2.导入数据时，文件必须关闭，不能在打开状态；<br/>
        </b></font>

        <center>
            <font color="red" size="4">导入结果如下</font><br/><br/>
            <font color="red" size="2">${errinfo}</font>
        </center>
</body>
</html>
